package cn.kgc.watch.web.admin;

import cn.kgc.watch.entity.ResultInfo;
import cn.kgc.watch.entity.vo.OrderPageInfoVo;
import cn.kgc.watch.service.OrderService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("adminOrder")
public class AdminOrderController {
    @Resource
    private OrderService orderService;
    @PostMapping("adminFindOrder")
    public ResultInfo adminFindOrder(@RequestBody  OrderPageInfoVo orderPageInfoVo){
        for (Integer integer : orderPageInfoVo.getStateList()) {
            System.out.println("integer = " + integer);
        }
        return new ResultInfo(200,"成功",this.orderService.findAllOrder(orderPageInfoVo));
    }
    @GetMapping("deliver")
    public ResultInfo deliver(String orderId){
        return new ResultInfo(200,"成功",this.orderService.modifyOrderStateAdmin(Integer.parseInt(orderId)));
    }
    @GetMapping("rejected")
    public ResultInfo rejected(String orderId){
        return new ResultInfo(200,"成功",this.orderService.modifyOrderPayStateAdmin(Integer.parseInt(orderId)));
    }
    @GetMapping("getNum")
    public ResultInfo getNum(){
        return new ResultInfo(200,"成功",this.orderService.findNum());
    }


}
